var mh = 36;//最小高度
var step = 1;//每次变化的px量
var ms = 10;//每隔多久循环一次
/*str代表a标签里的内容，Nam代表标签的属性（父节点的属性也可），如class的值*/
function toggle(o,str,Nam){
    /*改变标签状态的*/
    var el_a=document.getElementById(Nam);
    if(str=="收起"){
        el_a.innerHTML = "展开" ;
        el_a.parentNode.className="open"
    }
    if(str=="展开"){
        el_a.innerHTML = "收起" ;
        el_a.parentNode.className="close"
    }

    /*收缩展开*/
    if (!o.tid)o.tid = "_" + Math.random() * 100;
    if (!window.toggler)window.toggler = {};
    if (!window.toggler[o.tid]){
        window.toggler[o.tid]={
            obj:o,
            maxHeight:o.offsetHeight,
            minHeight:mh,
            timer:null,
            action:1
        };
    }
    o.style.height = o.offsetHeight + "px";
    if (window.toggler[o.tid].timer)clearTimeout(window.toggler[o.tid].timer);
    window.toggler[o.tid].action *= -1;
    window.toggler[o.tid].timer = setTimeout("anim('"+o.tid+"')",ms );
}
function anim(id){
    var t = window.toggler[id];
    var o = window.toggler[id].obj;
    if (t.action < 0){
        if (o.offsetHeight <= t.minHeight){
            clearTimeout(t.timer);
            return;
        }
    }
    else{
        if (o.offsetHeight >= t.maxHeight){
            clearTimeout(t.timer);
            return;
        }
    }
    o.style.height = (parseInt(o.style.height, 10) + t.action * step) + "px";
    window.toggler[id].timer = setTimeout("anim('"+id+"')",ms );
}